#include <iostream>
#include <omp.h>
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
using namespace std;
int getRand(int min, int max) {
    return (rand() % (max - min + 1)) + min;
}
void Gauss(float** data, int n) {
    for (int k = 0; k < n; k++) {
        #pragma omp parallel for schedule(static)
        for (int j = k + 1; j < n; j++) {
            data[k][j] = data[k][j] / data[k][k];
        }
        data[k][k] = 1.0;
        #pragma omp parallel for schedule(static)
        for (int i = k + 1; i < n; i++) {
            for (int j = k + 1; j < n; j++) {
                #pragma omp atomic
                data[i][j] -= data[i][k] * data[k][j];
            }
            data[i][k] = 0;
        }
    }
}
int main(){
    int n;
    cin>>n;
    float** data=new float*[n];
    for(int i=0;i<n;i++){
        data[i]=new float[n];
        for(int j=0;j<n;j++){
            data[i][j]=getRand(1,1000);
        }
    }
    clock_t start_time=clock();
    Gauss(data,n);
    clock_t end_time=clock();
    cout << "The run time is: " <<(double)(end_time - start_time) / CLOCKS_PER_SEC << "s" << endl;
    return 0;
}